package com.yunxi.service.dubboService.impl.sto;

import com.github.pagehelper.PageInfo;
import com.yunxi.model.sto.VehiclePdiBillDetail;
import com.yunxi.service.localService.sto.VehiclePdiBillDetailService;
import com.yunxi.sto.pojo.VehiclePdiBillDetailVO;
import com.yunxi.sto.service.VehiclePdiBillDetailDubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import java.util.List;

/**
 * <p>
 * 车辆pdi订单明细 服务实现类
 * </p>
 *
 * @author caoYong
 * @since 2019-08-14
 */
public class VehiclePdiBillDetailDubboServiceImpl implements VehiclePdiBillDetailDubboService {

    @Autowired
    @Qualifier(value = "vehiclePdiBillDetailServiceImpl")
    VehiclePdiBillDetailService vehiclePdiBillDetailService;


    @Override
    public VehiclePdiBillDetailVO getById(String id) throws Exception {
        VehiclePdiBillDetail vehiclePdiBillDetail = vehiclePdiBillDetailService.getById(id);
        if(vehiclePdiBillDetail == null )throw new Exception("操作失败,无法根据主键:"+id+"找到对应PDI明细!");
        VehiclePdiBillDetailVO vehiclePdiBillDetailVO = new VehiclePdiBillDetailVO();
        BeanUtils.copyProperties(vehiclePdiBillDetail, vehiclePdiBillDetailVO);
        return vehiclePdiBillDetailVO;
    }

    @Override
    public void saveOrUpdate(VehiclePdiBillDetailVO vehiclePdiBillDetailVO) throws Exception {
        VehiclePdiBillDetail vehiclePdiBillDetail = new VehiclePdiBillDetail();
        BeanUtils.copyProperties(vehiclePdiBillDetailVO, vehiclePdiBillDetail);
        vehiclePdiBillDetailService.saveOrUpdate(vehiclePdiBillDetail);
    }

    @Override
    public void removeById(String id) {
        vehiclePdiBillDetailService.removeById(id);
    }

    @Override
    public PageInfo<VehiclePdiBillDetailVO> findPageByVO(VehiclePdiBillDetailVO vehiclePdiBillDetailVO, Integer pageNum, Integer pageSize) throws Exception {
        PageInfo<VehiclePdiBillDetailVO> pageInfo = vehiclePdiBillDetailService.pageByVo(vehiclePdiBillDetailVO, pageNum, pageSize);
        return pageInfo;
    }

    @Override
    public void removeByListVo(List<VehiclePdiBillDetailVO> vehiclePdiBillDetailVOList) throws Exception {
        vehiclePdiBillDetailService.removeByListVo(vehiclePdiBillDetailVOList);
    }

    @Override
    public List listByVo(VehiclePdiBillDetailVO vehiclePdiBillDetailVO) {
        return vehiclePdiBillDetailService.listByVo(vehiclePdiBillDetailVO);
    }
}
